'use strict';

const Service = require('egg').Service;

class ExpService extends Service {
  // 当创建用户时，先新建预计表，默认值均为0，绑定openid
  async add(info) {
    return this.ctx.model.Exp.create(info)
  }
  async find(info) {
    return this.ctx.model.Exp.findOne(info).select('-_id -openid -__v')
  }
  // 用户可自行更新预计表的内容
  async update(openid, info) {
    return this.ctx.model.Exp.updateOne({ openid },info)
  }
}

module.exports = ExpService;
